package com.bnp.reporting.java8.collection;

import com.bnp.reporting.java8.entity.Person;

import java.util.Arrays;
import java.util.stream.Stream;

/**
 * Created by adib on 11/11/14.
 */
public class ArrayToStream {
    public static void main(String[] args) {
        Person[] people = {
                new Person(34, "Adib"),
                new Person(30, "Neeraj"),
                new Person(37, "HongFei")
        };
        for(int i = 0; i < people.length; i++){
            System.out.println(people[i].getInfo());
        }

        Stream<Person> stream = Stream.of(people);
        // now we can use Lambda expression, filter
        stream.forEach(p -> System.out.println(p.getInfo()));

        Stream<Person> streamArray = Arrays.stream(people);
        streamArray.forEach(p -> System.out.println(p.getInfo()));

    }
}
